package situ.autoweter.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import situ.autoweter.service.BeOrderService;
import situ.autoweter.entity.BeOrder;
import java.util.*;
/**
 * BeOrder的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class BeOrderController {

	/** BeOrderService服务 */
	@Autowired
	private BeOrderService beOrderService;
	
	/**
	 * 查询所有BeOrder数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "queryBeOrder", produces = {"application/json;charset=UTF-8"})
	public String find(BeOrder value,Map map) {
		 List<BeOrder> list= beOrderService.find(value);
         map.put("items",list);
         return "页面名称自己改";
	}
	
	/**
	 * 通过id查询BeOrder数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "queryBeOrderById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") String id,Map map) {
        BeOrder obj=  beOrderService.findOne(id);
        map.put("BeOrder",obj);
        return "页面名称自己改";
	}
	
	/**
	 * 插入BeOrder属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "saveBeOrder", produces = {"application/json;charset=UTF-8"})
	public String save(BeOrder value) {
		  beOrderService.saveNotNull(value);
        return "redirect:/queryBeOrder";
	}
	
	/**
	 * 更新BeOrder属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updateBeOrder", produces = {"application/json;charset=UTF-8"})
	public String update(BeOrder value) {
		  beOrderService.updateNotNullById(value);
          return "redirect:/queryBeOrder";
	}
	
	/**
	 * 通过id删除BeOrder数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "delBeOrderById/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") String id) {
		  beOrderService.deleteById(id);
          return "redirect:/queryBeOrder";
	}
}
